package tkM

import (
	"fmt"
	"db2s/go-log/log"
	"os"
)

// dirInit  目录初始化
func dirInit(path string) (err error) {
	var (
		event = "[dirInit]"
	)
	if _, err = os.Stat(path); err == nil {
		return
	}
	if os.IsNotExist(err) {
		if err = os.MkdirAll(path, os.ModePerm); err != nil {
			log.ErrorLog().Error(fmt.Sprintf("%v create dir path %v fail. error info is %s", event, path, err))
			return
		}
		return
	}
	log.ErrorLog().Error(fmt.Sprintf("%v open file %v fail, error is {%v}", event, path, err))
	return
}
